﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core.DS
{
    public static partial class status
    {
        public static dynamic canSubmitDSCode(int eid)
        {
            var sql = new Sql.SqlDataContext();
            var e = sql.DSExperiment.First(row => row.eid == eid);
            if (e == null) return new
            {
                success = false,
                msg = "实验不存在"
            };
            if (e.startTime != null)
                if (e.startTime.Value > DateTime.Now) return new
                   {
                       success = false,
                       msg = "实验未开始，请在实验开始时间之后提交。"
                   };
            if (e.endTime <= DateTime.Now) return new
               {
                   success = false,
                   msg = "提交超出截止时间，实验已结束。"
               };

            return new
            {
                success = true
            };
        }
    }
}
